package net.tngou.iask.quartz;

import java.util.List;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import net.tngou.iask.jdbc.DBManager;
import net.tngou.iask.pojo.Main;
import net.tngou.iask.service.MedicalService;

/**
 * 医学统计
 * @author tngou@tngou.net
 *
 */
public class MedicalJob implements Job {

	@SuppressWarnings("unchecked")
	@Override
	public void execute(JobExecutionContext arg0) throws JobExecutionException {
		MedicalService service = new MedicalService();
		List<Main> mains = (List<Main>) service.getList(Main.class);//取得实体说
		mains.forEach(e->{
			service.save(e.getId());//保存
			
		});
		DBManager.closeConnection(); //释放数据库连接到连接池中

	}
	
	public static void main(String[] args) throws JobExecutionException {
		new MedicalJob().execute(null);
	}

}
